#include "applyfriendrequestmessagetoserver.h"

ApplyFriendRequestMessageToServer::ApplyFriendRequestMessageToServer(const UserId& userId,
                    const FriendId& friendId, const Alias& alias, const VerifyInfo& verifyInfo)
{
    m_messageType = MessageType::ApplyFriendRequestToServer;
    m_userId = userId;
    m_friendId = friendId;
    m_alias = alias;
    m_verifyInfo = verifyInfo;
}

ApplyFriendRequestMessageToServer::ApplyFriendRequestMessageToServer(const QJsonObject& jsonObj)
{
    m_messageType = static_cast<MessageType>(jsonObj[JsonKey::TYPE].toInt());
    m_userId = jsonObj[JsonKey::USER_ID].toString();
    m_friendId = jsonObj[JsonKey::FRIEND_ID].toString();
    m_alias = jsonObj[JsonKey::ALIAS].toString();
    m_verifyInfo = jsonObj[JsonKey::VERIFY_INFO].toString();
}

QJsonObject ApplyFriendRequestMessageToServer::PackJsonData() const
{
    QJsonObject jsonObj;
    jsonObj[JsonKey::TYPE] = static_cast<int>(m_messageType);
    jsonObj[JsonKey::USER_ID] = m_userId;
    jsonObj[JsonKey::FRIEND_ID] = m_friendId;
    jsonObj[JsonKey::ALIAS] = m_alias;
    jsonObj[JsonKey::VERIFY_INFO] = m_verifyInfo;
    return jsonObj;
}

UserId ApplyFriendRequestMessageToServer::getUserId() const
{
    return m_userId;
}

FriendId ApplyFriendRequestMessageToServer::getFriendId() const
{
    return m_friendId;
}

Alias ApplyFriendRequestMessageToServer::getAlias() const
{
    return m_alias;
}

VerifyInfo ApplyFriendRequestMessageToServer::getVerifyInfo() const
{
    return m_verifyInfo;
}

